#ifndef CONNECTOR_H
#define CONNECTOR_H

#include <QTcpSocket>
#include <QObject>
#include <QAbstractSocket>
#include <QHttpRequestHeader>
#include <QNetworkReply>
#include <QFile>
#include <QNetworkAccessManager>
#include <QtXml>
 
class Connector : public QObject
{
    Q_OBJECT
    QTcpSocket *socket;
    QTcpSocket *browser;
    QNetworkAccessManager* http;
    QString getSingleAttributeValue(QDomNode, QString);
    QString getSingleTagValue(QDomNode, QString);
    QMap<QString, int> hashMap;
    QString message;
public:
    explicit Connector(QObject *parent = 0);
    void downloadPage(int, QString);
signals:
    void decode(int hash, QIODevice* socket);
    void connErr(QAbstractSocket::SocketError);
public slots:
    void send(int hash, QString answer);
    void parseMessage();
    void requestFinnished(QNetworkReply*);
    void connectEd(QString);
    void displayError(QAbstractSocket::SocketError);
    void displayError(QNetworkReply::NetworkError);
    void proxySwitched(bool,QString,int);
};

#endif // CONNECTOR_H
